FROM php:7.4.33-fpm


RUN  apt-get update &&  apt-get install  -y  vim  grep  git  unzip  

RUN  apt-get install  -y  gcc   libjpeg-dev  librsvg2-dev  libwebp-dev  libpng-dev  libzip-dev  yasm \
    libxml2  libxml2-dev  openssl  curl  autoconf  libevent-dev   libicu-dev   idn2  libidn2-dev  idn \
    libltdl-dev  libx11-dev   bzip2   file   make   re2c  libxext-dev  libxt-dev ghostscript   fftw-dev   libharfbuzz-dev  \
    libssl-dev  libsqlite3-dev  libcurl4-openssl-dev  sqlite3  libtiff-dev  libmagickwand-dev  libmagickcore-dev  librdkafka-dev  librdkafka1 \
    openssh-server  openssh-client  build-essential  libpcre3  libpcre3-dev   zlib1g-dev  libpq-dev  imagemagick 



RUN  mkdir -p /app/www &&  mkdir -p /app/bin 

WORKDIR  /app/www/php

ENV  TZ=Asia/Shanghai

## -j$(nproc) 意思是尽可能多的使用CPU核心数来进行编译
RUN  docker-php-ext-enable  opcache  \
     && docker-php-ext-configure  bcmath  && docker-php-ext-install -j$(nproc)   bcmath \
	 && docker-php-ext-configure  pcntl  && docker-php-ext-install -j$(nproc)  pcntl  \
	 && docker-php-ext-configure  gd  && docker-php-ext-install -j$(nproc)  gd \
	 && docker-php-ext-configure  sockets  && docker-php-ext-install -j$(nproc)   sockets  \
	 && docker-php-ext-configure  sysvmsg  && docker-php-ext-install -j$(nproc)   sysvmsg  \
	 && docker-php-ext-configure  sysvsem  && docker-php-ext-install -j$(nproc)   sysvsem  \
	 && docker-php-ext-configure  sysvshm  && docker-php-ext-install -j$(nproc)   sysvshm  \
	 && docker-php-ext-configure  shmop  && docker-php-ext-install -j$(nproc)   shmop  \
	 && docker-php-ext-configure  zip  && docker-php-ext-install -j$(nproc)   zip  \
	 && docker-php-ext-configure  ftp  && docker-php-ext-install -j$(nproc)   ftp  \
	 && docker-php-ext-configure  soap  && docker-php-ext-install -j$(nproc)   soap  \
	 && docker-php-ext-configure  xml  && docker-php-ext-install -j$(nproc)   xml  \
     && docker-php-ext-configure  pdo_mysql  && docker-php-ext-install -j$(nproc)   pdo_mysql  \ 
	 && docker-php-ext-configure  pdo_pgsql  && docker-php-ext-install -j$(nproc)   pdo_pgsql  \ 
	 && docker-php-ext-configure  exif  && docker-php-ext-install -j$(nproc)   exif  


RUN  pecl install  redis  &&  docker-php-ext-enable  redis\
	 && pecl install  xdebug-2.9.8  &&  docker-php-ext-enable  xdebug \
     && pecl install  propro-2.1.0  && pecl install  raphf-2.0.1  && docker-php-ext-enable  raphf  propro \
	 && pecl install  pecl_http-3.2.1  &&  docker-php-ext-enable   http  \
	 && pecl install  rar  &&  docker-php-ext-enable   rar  \
	 && pecl install  imagick  &&  docker-php-ext-enable   imagick \
	 && pecl install  rdkafka  &&  docker-php-ext-enable   rdkafka \
     && pecl download  swoole-4.8.13  && tar -xvf  swoole-4.8.13.tgz && rm -rf  swoole-4.8.13.tgz  \
	 && cd  swoole-4.8.13 &&  phpize &&  ./configure --enable-openssl --enable-http2 --enable-mysqlnd --enable-sockets  --enable-curl  --enable-json --enable-pcre \
	 && make && make install  &&  cd .. &&  rm -rf  swoole-4.8.13  &&  docker-php-ext-enable   swoole  \
	 && echo "swoole.use_shortname = Off" >>  /usr/local/etc/php/conf.d/docker-php-ext-swoole.ini



RUN  php -r "copy('https://install.phpcomposer.com/installer', 'composer-setup.php');"  &&  php composer-setup.php  &&  php -r "unlink('composer-setup.php');" \
     &&  mv  composer.phar  /app/bin/   &&  ln -s  /app/bin/composer.phar   /usr/local/bin/composer

RUN  /usr/local/bin/composer config -g repos.packagist composer https://mirrors.aliyun.com/composer/



EXPOSE 9000



CMD ["php-fpm"]



##Windows  挂载目录
## docker  run --name  php  -p  9000:9000  -v  E:/www:/app/www  -d  php 

## docker  run --name  php  -p  9000:9000  -v  E:\www:/app/www  -v E:\www\docker\php\php-fpm.conf:/usr/local/etc/php-fpm.conf  -v  E:\www\docker\php\www.conf:/usr/local/etc/php-fpm.d/www.conf  -v E:\www\docker\php\php.ini:/usr/local/etc/php/php.ini -d  php



##Linux
## docker  run --name  php  -p  9000:9000  -v  /app/www:/app/www  -d  php    挂载目录
















